<?php 
	/**
	 * 主程序， 从库中统计昨日的数据，生成记录的sql文件，上传至服务器，并发送邮件通知
	 */
	include_once dirname(dirname(__FILE__))."/include/common.inc.php";
	include_once dirname(dirname(__FILE__))."/ganji/function.ganji.php";
	$global_site = "ganji";
	
	//只抓取昨天的数据
	$yesterday = date("Y-m-d", time()-60*60*24);
	$date = '2012-12-05';
	$sql ="select * from competitor_201212 where fetch_date='2012-12-05' and `from`='ganji'";
	$query = $conn->query($sql);
	while ($row = $conn->fetch_array()) {
		$insql = "insert into ganji_user set id=".$row['source_user_id'].",city='".$row['city']."',province='". $row['province']."',age=".$row['age'].",sex='".$row['gender']."',has_photo=".$row['has_photo'].",ymd='2012-12-05'";
		$query = $conn->query($insql);
	}
?>